#ifndef __LOG_MANAGER_H__
#define __LOG_MANAGER_H__

#include <fstream>
using namespace std;

#include <time.h> 

class LogManager : public ofstream
{
public:
	LogManager(const char * filename, ios_base::openmode mode = ios_base::in)
	:ofstream(filename,mode)
	{		
	}
};
extern LogManager myLoggerRef;

#define __TIME_FILE_LINE__

#ifdef __TIME_FILE_LINE__

#define logger \
	{ \
		time_t log_t = time(0); \
		char tmpLog[64]; \
		struct tm s_time; \
		localtime_s(&s_time,&log_t); \
		strftime( tmpLog, sizeof(tmpLog), "%Y/%m/%d %X", &s_time );\
													\
		myLoggerRef << tmpLog ;\
		myLoggerRef << "\t" << __FILE__ << ":" ;\
		myLoggerRef << __LINE__; \
		myLoggerRef << "\t\t" ; \
	} \
	myLoggerRef \

#else

#define logger \
	{ \
		time_t log_t = time(0); \
		char tmpLog[64]; \
		strftime( tmpLog, sizeof(tmpLog), "%Y/%m/%d %X",localtime(&log_t) );\
													\
		myLoggerRef << tmpLog ;\
		myLoggerRef << "\t\t" ; \
	} \
	myLoggerRef \


#endif // __TIME_FILE_LINE__


#endif // __LOG_MANAGER_H__
